import { encryptPassword, randomSalt } from "@sker/core";
import { useReqIp } from "./req";

export async function generateUser(username: string, password: string){
    // 生成salt
    const salt = randomSalt();
    const ip = useReqIp();
    const _encryptPassword = await encryptPassword(password, salt)
    // 加密password
    const user = {
        username: username,
        password: _encryptPassword,
        status: false,
        salt,
        joinip: ip,
        joindate: new Date(),
        welcome_link: '/imeepos/core/web/addon',
        notice_setting: {},
        is_bind: false,
        lastvisit: new Date(),
    }
    return user;
}